package com.yanfan.parking.service.impl;

import java.util.Arrays;
import java.util.List;
import com.yanfan.common.utils.StringUtils;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yanfan.parking.mapper.NjParkingHourFlowMapper;
import com.yanfan.parking.domain.NjParkingHourFlow;
import com.yanfan.parking.service.INjParkingHourFlowService;

/**
 * 车流量统计Service业务层处理
 *
 * @author genluo
 * @date 2024-11-05
 */
@Service
public class NjParkingHourFlowServiceImpl extends ServiceImpl<NjParkingHourFlowMapper, NjParkingHourFlow> implements INjParkingHourFlowService {
    @Autowired
    private NjParkingHourFlowMapper njParkingHourFlowMapper;


    /**
     * 查询车流量统计列表
     *
     * @param njParkingHourFlow 车流量统计
     * @return 车流量统计
     */
    @Override
    public List<NjParkingHourFlow> queryPageList(NjParkingHourFlow njParkingHourFlow) {
        LambdaQueryWrapper<NjParkingHourFlow> lqw = buildQueryWrapper(njParkingHourFlow);
        return njParkingHourFlowMapper.selectList(lqw);
        //连表查询可用该方法，在此方法SQL语句上进行扩展
        //return njParkingHourFlowMapper.queryPageList(njParkingHourFlow);
    }

    /**
    * 分页查询条件
    * @return
    */
    private LambdaQueryWrapper<NjParkingHourFlow> buildQueryWrapper(NjParkingHourFlow bo) {
        LambdaQueryWrapper<NjParkingHourFlow> lqw = Wrappers.lambdaQuery();
        lqw.like(StringUtils.isNotBlank(bo.getDates()), NjParkingHourFlow::getDates, bo.getDates());
        lqw.orderByAsc(NjParkingHourFlow::getDates);
        return lqw;
    }



}
